<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Render HTML Map</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
MathJax = {
	tex: {
		inlineMath: '$', '$'], ['\\(', '\\)'
	},
	svg: {
		fontCache: 'global'
	}
};
</script>
<script type="text/javascript" id="MathJax-script" async
	src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js">
</script>

<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Render HTML Map' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../intern.html">Inter Modules</a></li><li><a href="index.html">index</a></li><li><a href="index.html#4">Chapter 4: Spatial Mapping</a></li><li><b>Render HTML Map</b></li></ul></div>
<p class="purpose">To render the spatial map of rooms as HTML.</p>

<ul class="toc"><li><a href="4-rhm.html#SP1">&#167;1. Building the grids</a></li><li><a href="4-rhm.html#SP7">&#167;7. Nested HTML Tables</a></li><li><a href="4-rhm.html#SP9">&#167;9. Icon images</a></li><li><a href="4-rhm.html#SP10">&#167;10. Room colours</a></li><li><a href="4-rhm.html#SP11">&#167;11. The major map</a></li><li><a href="4-rhm.html#SP12">&#167;12. Level rubrics</a></li><li><a href="4-rhm.html#SP13">&#167;13. Single-room submaps</a></li><li><a href="4-rhm.html#SP14">&#167;14. Plotting a rectangle of the map</a></li><li><a href="4-rhm.html#SP14_2_1_1">&#167;14.2.1.1. Substantive cells</a></li><li><a href="4-rhm.html#SP14_2_1_2">&#167;14.2.1.2. Numbering cells</a></li><li><a href="4-rhm.html#SP16">&#167;16. Plotting the eight exterior icons</a></li><li><a href="4-rhm.html#SP17">&#167;17. Plotting the single central square</a></li><li><a href="4-rhm.html#SP18">&#167;18. The colour chip</a></li><li><a href="4-rhm.html#SP19">&#167;19. The regions key</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Building the grids.</b>Three three-dimensional arrays called "grids" are used to store a rasterised
version of the map before we render this on screen.
</p>

<p class="commentary">The <span class="extract"><span class="extract-syntax">room_grid</span></span> tells us which room can be found at \((x, y, z)\), while the
<span class="extract"><span class="extract-syntax">icon_grid</span></span> is 25 times larger since it splits each room cell into a 5 by 5
subgrid of icons. Bitmaps stored in the 16 icon cells around the perimeter
of the 5 by 5 subgrid tell us which exits to mark (and since we map only 12
kinds of exit, this means that four of them are unused). The central 3 by 3
part of the subgrid is not used: nothing can be plotted there since that's
where the room icon goes, which is made not with an image tag but using the
HTML table routine below. We will often use the wasteful coordinate system
\((x, y, z, i_1, i_2)\) to mean the icon at \((i_1, i_2)\) (with $0\leq i_1,
i_2\leq 4\() associated with the room cell at \)(x, y, z)$.
</p>

<p class="commentary">The <span class="extract"><span class="extract-syntax">exit_grid</span></span> stores which direction number is the exit being marked at
this icon position, and has the same indexing as the icon grid.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="identifier-syntax">ROOM_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">) </span><a href="4-sg.html#SP14" class="function-link"><span class="function-syntax">Geometry::cuboid_index</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">calc</span><span class="plain-syntax">.</span><span class="element-syntax">Universe</span><span class="plain-syntax">)</span>
<span class="definition-keyword">define</span> <span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">i1</span><span class="plain-syntax">, </span><span class="identifier-syntax">i2</span><span class="plain-syntax">) (25*</span><span class="identifier-syntax">ROOM_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">) + </span><span class="constant-syntax">5</span><span class="plain-syntax">*(</span><span class="identifier-syntax">i1</span><span class="plain-syntax">) + (</span><span class="identifier-syntax">i2</span><span class="plain-syntax">))</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> **</span><span class="identifier-syntax">room_grid</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">int</span><span class="plain-syntax"> *</span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, *</span><span class="identifier-syntax">exit_grid</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::calculate_map_grid</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">HTMLMap::calculate_map_grid</span></span>:<br/><a href="4-rhm.html#SP11">&#167;11</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">index_session</span><span class="plain-syntax"> *</span><span class="identifier-syntax">session</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">faux_instance_set</span><span class="plain-syntax"> *</span><span class="identifier-syntax">faux_set</span><span class="plain-syntax"> = </span><a href="1-ia.html#SP12" class="function-link"><span class="function-syntax">Indexing::get_set_of_instances</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP1_1" class="named-paragraph-link"><span class="named-paragraph">Allocate the three mapping grids</span><span class="named-paragraph-number">1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP1_2" class="named-paragraph-link"><span class="named-paragraph">Populate the room grid</span><span class="named-paragraph-number">1.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP1_3" class="named-paragraph-link"><span class="named-paragraph">Populate the icon and exit grids</span><span class="named-paragraph-number">1.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP1_4" class="named-paragraph-link"><span class="named-paragraph">Apply the remaining nuance bits to the icon grid</span><span class="named-paragraph-number">1.4</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP1_1" class="paragraph-anchor"></a><b>&#167;1.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Allocate the three mapping grids</span><span class="named-paragraph-number">1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">size_needed</span><span class="plain-syntax"> = </span><a href="4-sg.html#SP14" class="function-link"><span class="function-syntax">Geometry::cuboid_volume</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">session</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">calc</span><span class="plain-syntax">.</span><span class="element-syntax">Universe</span><span class="plain-syntax">), </span><span class="identifier-syntax">x</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">room_grid</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> **)</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">Memory::calloc</span><span class="plain-syntax">(</span><span class="identifier-syntax">size_needed</span><span class="plain-syntax">, </span><span class="reserved-syntax">sizeof</span><span class="plain-syntax">(</span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *), </span><span class="constant-syntax">MAP_INDEX_MREASON</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">x</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">x</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">size_needed</span><span class="plain-syntax">; </span><span class="identifier-syntax">x</span><span class="plain-syntax">++) </span><span class="identifier-syntax">room_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">x</span><span class="plain-syntax">] = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> *)</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">Memory::calloc</span><span class="plain-syntax">(25*</span><span class="identifier-syntax">size_needed</span><span class="plain-syntax">, </span><span class="reserved-syntax">sizeof</span><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax">), </span><span class="constant-syntax">MAP_INDEX_MREASON</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">exit_grid</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> *)</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">Memory::calloc</span><span class="plain-syntax">(25*</span><span class="identifier-syntax">size_needed</span><span class="plain-syntax">, </span><span class="reserved-syntax">sizeof</span><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax">), </span><span class="constant-syntax">MAP_INDEX_MREASON</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">x</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">x</span><span class="plain-syntax">&lt;25*</span><span class="identifier-syntax">size_needed</span><span class="plain-syntax">; </span><span class="identifier-syntax">x</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">x</span><span class="plain-syntax">] = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">exit_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">x</span><span class="plain-syntax">] = -1;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP1">&#167;1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP1_2" class="paragraph-anchor"></a><b>&#167;1.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Populate the room grid</span><span class="named-paragraph-number">1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">R</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_FAUX_ROOMS</span><span class="plain-syntax">(</span><span class="identifier-syntax">faux_set</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">room_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ROOM_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">Room_position</span><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">))] = </span><span class="identifier-syntax">R</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP1">&#167;1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP1_3" class="paragraph-anchor"></a><b>&#167;1.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Populate the icon and exit grids</span><span class="named-paragraph-number">1.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">R</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_FAUX_ROOMS</span><span class="plain-syntax">(</span><span class="identifier-syntax">faux_set</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">exit</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOOP_OVER_STORY_DIRECTIONS</span><span class="plain-syntax">(</span><span class="identifier-syntax">exit</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-sm.html#SP12" class="function-link"><span class="function-syntax">SpatialMap::direction_is_mappable</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">exit</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="comment-syntax"> door which the exit passes through, if it does</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">T</span><span class="plain-syntax"> = </span><a href="4-sm.html#SP21" class="function-link"><span class="function-syntax">SpatialMap::room_exit</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">, </span><span class="identifier-syntax">exit</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">D</span><span class="plain-syntax">); </span><span class="comment-syntax"> target at the other end</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">T</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">D</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP1_3_1" class="named-paragraph-link"><span class="named-paragraph">Fill in the grid-square for this exit of room R</span><span class="named-paragraph-number">1.3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP1">&#167;1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>We next define constants needed for the icon bitmap. The information
we extract from the map exits is recorded in the low four bits as
follows:
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">EXIT_MAPBIT</span><span class="plain-syntax">       </span><span class="constant-syntax">0x00000001</span><span class="plain-syntax"> </span><span class="comment-syntax"> An exit leads this way</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">DOOR1_MAPBIT</span><span class="plain-syntax">      </span><span class="constant-syntax">0x00000002</span><span class="plain-syntax"> </span><span class="comment-syntax"> Into a 1-sided door</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">DOOR2_MAPBIT</span><span class="plain-syntax">      </span><span class="constant-syntax">0x00000004</span><span class="plain-syntax"> </span><span class="comment-syntax"> Into a 2-sided door</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONNECTIVE_BITMAP</span><span class="plain-syntax"> (</span><span class="constant-syntax">EXIT_MAPBIT</span><span class="plain-syntax">+</span><span class="constant-syntax">DOOR1_MAPBIT</span><span class="plain-syntax">+</span><span class="constant-syntax">DOOR2_MAPBIT</span><span class="plain-syntax">)</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>The higher bits are used for the nuances which improve the map when
several rooms are plotted together.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">ADJACENT_MAPBIT</span><span class="plain-syntax">   </span><span class="constant-syntax">0x00000008</span><span class="plain-syntax"> </span><span class="comment-syntax"> Into the room adjacent in space</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">ALIGNED_MAPBIT</span><span class="plain-syntax">    </span><span class="constant-syntax">0x00000010</span><span class="plain-syntax"> </span><span class="comment-syntax"> Into a room in correct direction</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">FADING_MAPBIT</span><span class="plain-syntax">     </span><span class="constant-syntax">0x00000020</span><span class="plain-syntax"> </span><span class="comment-syntax"> There's a broken exit on ...</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">MEET_MAPBIT</span><span class="plain-syntax">       </span><span class="constant-syntax">0x00000040</span><span class="plain-syntax"> </span><span class="comment-syntax"> This door should meet the adjacent one</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CROSSDOOR_MAPBIT</span><span class="plain-syntax">  </span><span class="constant-syntax">0x00000080</span><span class="plain-syntax"> </span><span class="comment-syntax"> There's a door on the diagonal athwart</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CROSSDOT_MAPBIT</span><span class="plain-syntax">   </span><span class="constant-syntax">0x00000100</span><span class="plain-syntax"> </span><span class="comment-syntax"> There's a plain exit on ...</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>Five bits are used for the possible contents of a central square: it may
be occupied by an actual room, or it may have a pile of long straight-line
connections running through it, in any combination.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">LONGEW_MAPBIT</span><span class="plain-syntax">     </span><span class="constant-syntax">0x00000200</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">LONGNS_MAPBIT</span><span class="plain-syntax">     </span><span class="constant-syntax">0x00000400</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">LONGSWNE_MAPBIT</span><span class="plain-syntax">   </span><span class="constant-syntax">0x00000800</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">LONGNWSE_MAPBIT</span><span class="plain-syntax">   </span><span class="constant-syntax">0x00001000</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">OCCUPIED_MAPBIT</span><span class="plain-syntax">   </span><span class="constant-syntax">0x10000000</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">LONGS_BITMAP</span><span class="plain-syntax">      (</span><span class="constant-syntax">LONGEW_MAPBIT</span><span class="plain-syntax">+</span><span class="constant-syntax">LONGNS_MAPBIT</span><span class="plain-syntax">+</span><span class="constant-syntax">LONGSWNE_MAPBIT</span><span class="plain-syntax">+</span><span class="constant-syntax">LONGNWSE_MAPBIT</span><span class="plain-syntax">)</span>
</pre>
<p class="commentary firstcommentary"><a id="SP1_3_1" class="paragraph-anchor"></a><b>&#167;1.3.1. </b>The following code calculates the low four bits of the icon bitmap
grid. Note that the main map grid must already be finished before this
stage can even begin.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Fill in the grid-square for this exit of room R</span><span class="named-paragraph-number">1.3.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i1</span><span class="plain-syntax">, </span><span class="identifier-syntax">i2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="4-sm.html#SP19" class="function-link"><span class="function-syntax">SpatialMap::cell_position_for_direction</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">exit</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">i1</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">i2</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">bitmap</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">D</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">T</span><span class="plain-syntax">) </span><span class="identifier-syntax">bitmap</span><span class="plain-syntax"> |= </span><span class="constant-syntax">DOOR2_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">bitmap</span><span class="plain-syntax"> |= </span><span class="constant-syntax">DOOR1_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">T</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bitmap</span><span class="plain-syntax"> |= </span><span class="constant-syntax">EXIT_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">vector</span><span class="plain-syntax"> </span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="4-sm.html#SP13" class="function-link"><span class="function-syntax">SpatialMap::direction_as_vector</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">exit</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><a href="4-sg.html#SP6" class="function-link"><span class="function-syntax">Geometry::vec_eq</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">E</span><span class="plain-syntax">, </span><span class="identifier-syntax">Zero_vector</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">            (</span><a href="4-sm.html#SP16" class="function-link"><span class="function-syntax">SpatialMap::direction_is_lateral</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">exit</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP1_3_1_1" class="named-paragraph-link"><span class="named-paragraph">Set the adjacent or aligned bit if the target lies in the correct direction</span><span class="named-paragraph-number">1.3.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP1_3_1_2" class="named-paragraph-link"><span class="named-paragraph">Set the fading bit if another room lies where the target ought to be</span><span class="named-paragraph-number">1.3.1.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">Room_position</span><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">), </span><span class="identifier-syntax">i1</span><span class="plain-syntax">, </span><span class="identifier-syntax">i2</span><span class="plain-syntax">)] = </span><span class="identifier-syntax">bitmap</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">exit_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">Room_position</span><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">), </span><span class="identifier-syntax">i1</span><span class="plain-syntax">, </span><span class="identifier-syntax">i2</span><span class="plain-syntax">)] = </span><span class="identifier-syntax">exit</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP1_3">&#167;1.3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP1_3_1_1" class="paragraph-anchor"></a><b>&#167;1.3.1.1. </b>Suppose we are looking east from the Ballroom to the Kitchens. If the Kitchens
will indeed be plotted at the position directly east of the Ballroom, we award
the "adjacent" bit; if they will be plotted due east, but further away than
a single square distant, then we get the "aligned" bit as a consolation prize.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Set the adjacent or aligned bit if the target lies in the correct direction</span><span class="named-paragraph-number">1.3.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">vector</span><span class="plain-syntax"> </span><span class="identifier-syntax">V</span><span class="plain-syntax"> = </span><a href="4-sg.html#SP7" class="function-link"><span class="function-syntax">Geometry::vec_minus</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">Room_position</span><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">), </span><span class="identifier-syntax">Room_position</span><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">lambda</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">lambda</span><span class="plain-syntax">=1; </span><span class="identifier-syntax">lambda</span><span class="plain-syntax">&lt;10; </span><span class="identifier-syntax">lambda</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-sg.html#SP6" class="function-link"><span class="function-syntax">Geometry::vec_eq</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">V</span><span class="plain-syntax">, </span><a href="4-sg.html#SP7" class="function-link"><span class="function-syntax">Geometry::vec_scale</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">lambda</span><span class="plain-syntax">, </span><span class="identifier-syntax">E</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">lambda</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="identifier-syntax">bitmap</span><span class="plain-syntax"> |= </span><span class="constant-syntax">ADJACENT_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">bitmap</span><span class="plain-syntax"> |= </span><span class="constant-syntax">ALIGNED_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP1_3_1">&#167;1.3.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP1_3_1_2" class="paragraph-anchor"></a><b>&#167;1.3.1.2. </b>If a different room altogether &mdash; say, the Tack Room &mdash; is being plotted one
square east of the Ballroom, even though the map connection leads to the
Kitchens, then we get the "fading" bit. (At one time connections like this
were going to be plotted in a sort of fading-away grey gradient, hence the
name, but in the end a more cartoonish break looked better.) This is not
exclusive with the aligned bit: we might have a situation where the map
be will be plotted left-to-right as B, TR, K, even though the connection
is east from B to K. If so, we get both the fading and aligned bits.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Set the fading bit if another room lies where the target ought to be</span><span class="named-paragraph-number">1.3.1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">vector</span><span class="plain-syntax"> </span><span class="identifier-syntax">Farend</span><span class="plain-syntax"> = </span><a href="4-sg.html#SP7" class="function-link"><span class="function-syntax">Geometry::vec_plus</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">Room_position</span><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">), </span><span class="identifier-syntax">E</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">R</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_FAUX_ROOMS</span><span class="plain-syntax">(</span><span class="identifier-syntax">faux_set</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">R</span><span class="plain-syntax"> != </span><span class="identifier-syntax">T</span><span class="plain-syntax">) &amp;&amp; (</span><a href="4-sg.html#SP6" class="function-link"><span class="function-syntax">Geometry::vec_eq</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">Room_position</span><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">), </span><span class="identifier-syntax">Farend</span><span class="plain-syntax">)))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">bitmap</span><span class="plain-syntax"> |= </span><span class="constant-syntax">FADING_MAPBIT</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP1_3_1">&#167;1.3.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP1_4" class="paragraph-anchor"></a><b>&#167;1.4. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Apply the remaining nuance bits to the icon grid</span><span class="named-paragraph-number">1.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">R</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_FAUX_ROOMS</span><span class="plain-syntax">(</span><span class="identifier-syntax">faux_set</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">Room_position</span><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">), </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">)] = </span><span class="constant-syntax">OCCUPIED_MAPBIT</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_FAUX_ROOMS</span><span class="plain-syntax">(</span><span class="identifier-syntax">faux_set</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">vector</span><span class="plain-syntax"> </span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Room_position</span><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP5" class="function-link"><span class="function-syntax">HTMLMap::correct_pair</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">SW_vector</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP5" class="function-link"><span class="function-syntax">HTMLMap::correct_pair</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">W_vector</span><span class="plain-syntax">,  </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP5" class="function-link"><span class="function-syntax">HTMLMap::correct_pair</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">NW_vector</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP5" class="function-link"><span class="function-syntax">HTMLMap::correct_pair</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">S_vector</span><span class="plain-syntax">,  </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP5" class="function-link"><span class="function-syntax">HTMLMap::correct_pair</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">N_vector</span><span class="plain-syntax">,  </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP5" class="function-link"><span class="function-syntax">HTMLMap::correct_pair</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">SE_vector</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP5" class="function-link"><span class="function-syntax">HTMLMap::correct_pair</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">E_vector</span><span class="plain-syntax">,  </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP5" class="function-link"><span class="function-syntax">HTMLMap::correct_pair</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">NE_vector</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP1">&#167;1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>A process called "pair correction" fills in the nuance bits for all
adjacent icons representing the same exit. Thus the east side icon of
one room may need to be married up with the west side icon of the
adjacent room, and so on. The four by four cornices diagonally in
between rooms require special care. To plot a northeast exit blocked by
a 2-sided door, for instance, requires all four icons to be plotted, but
we need to be careful in case the two icons not occupied by the exit are
needed for something else (if a northwest exit crossed over it, for
faux_instance).
</p>

<p class="commentary">Here \(P\) is the position of the room we're looking at, and \(D\) an offset
vector to one of its eight neighbouring cell positions on the map. If
\(P+D\) lies outside the map altogether, we do nothing.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::correct_pair</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">HTMLMap::correct_pair</span></span>:<br/><a href="4-rhm.html#SP1_4">&#167;1.4</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">vector</span><span class="plain-syntax"> </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="reserved-syntax">vector</span><span class="plain-syntax"> </span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">from_i1</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">from_i2</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">to_i1</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">to_i2</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">index_session</span><span class="plain-syntax"> *</span><span class="identifier-syntax">session</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">vector</span><span class="plain-syntax"> </span><span class="identifier-syntax">Q</span><span class="plain-syntax"> = </span><a href="4-sg.html#SP7" class="function-link"><span class="function-syntax">Geometry::vec_plus</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">D</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-sg.html#SP13" class="function-link"><span class="function-syntax">Geometry::within_cuboid</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">calc</span><span class="plain-syntax">.</span><span class="element-syntax">Universe</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">; </span><span class="comment-syntax"> should never happen</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-sg.html#SP13" class="function-link"><span class="function-syntax">Geometry::within_cuboid</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">Q</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">calc</span><span class="plain-syntax">.</span><span class="element-syntax">Universe</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">; </span><span class="comment-syntax"> neighbour outside map</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">from</span><span class="plain-syntax"> = </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">from_i1</span><span class="plain-syntax">, </span><span class="identifier-syntax">from_i2</span><span class="plain-syntax">)];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">to</span><span class="plain-syntax"> = </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">Q</span><span class="plain-syntax">, </span><span class="identifier-syntax">to_i1</span><span class="plain-syntax">, </span><span class="identifier-syntax">to_i2</span><span class="plain-syntax">)];</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">D</span><span class="plain-syntax">.</span><span class="element-syntax">x</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">D</span><span class="plain-syntax">.</span><span class="identifier-syntax">y</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">)) </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP5_2" class="named-paragraph-link"><span class="named-paragraph">Apply nuance bits for a rank or file direction</span><span class="named-paragraph-number">5.2</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP5_3" class="named-paragraph-link"><span class="named-paragraph">Apply nuance bits for a diagonal direction</span><span class="named-paragraph-number">5.3</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">from</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">ALIGNED_MAPBIT</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP5_1" class="named-paragraph-link"><span class="named-paragraph">Lay out a long roadway towards our destination cell</span><span class="named-paragraph-number">5.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5_1" class="paragraph-anchor"></a><b>&#167;5.1. </b>Let's see how the "long" bits are added first, since that's easier. The
following looks disturbingly like an infinite loop: it lays out the roadway,
one cell at a time (adding the direction vector \(D\) to our position \(P\) each
turn) but stops when it hits an occupied cell &mdash; one with a room plotted in
it. This must eventually happen because the exit is "aligned", which means
that it leads to a room whose position is some multiple of \(D\) offset from
the original. So the loop always terminates.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Lay out a long roadway towards our destination cell</span><span class="named-paragraph-number">5.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><a href="4-sg.html#SP7" class="function-link"><span class="function-syntax">Geometry::vec_plus</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">D</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">)] &amp; </span><span class="constant-syntax">OCCUPIED_MAPBIT</span><span class="plain-syntax">) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><a href="4-sg.html#SP6" class="function-link"><span class="function-syntax">Geometry::vec_eq</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">E_vector</span><span class="plain-syntax">)) || (</span><a href="4-sg.html#SP6" class="function-link"><span class="function-syntax">Geometry::vec_eq</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">W_vector</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">)] = </span><span class="constant-syntax">EXIT_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">)] |= </span><span class="constant-syntax">LONGEW_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">)] = </span><span class="constant-syntax">EXIT_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><a href="4-sg.html#SP6" class="function-link"><span class="function-syntax">Geometry::vec_eq</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">N_vector</span><span class="plain-syntax">)) || (</span><a href="4-sg.html#SP6" class="function-link"><span class="function-syntax">Geometry::vec_eq</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">S_vector</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">)] = </span><span class="constant-syntax">EXIT_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">)] |= </span><span class="constant-syntax">LONGNS_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">)] = </span><span class="constant-syntax">EXIT_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><a href="4-sg.html#SP6" class="function-link"><span class="function-syntax">Geometry::vec_eq</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">SW_vector</span><span class="plain-syntax">)) || (</span><a href="4-sg.html#SP6" class="function-link"><span class="function-syntax">Geometry::vec_eq</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">NE_vector</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">)] = </span><span class="constant-syntax">EXIT_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">)] |= </span><span class="constant-syntax">LONGSWNE_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">)] = </span><span class="constant-syntax">EXIT_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><a href="4-sg.html#SP6" class="function-link"><span class="function-syntax">Geometry::vec_eq</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">NW_vector</span><span class="plain-syntax">)) || (</span><a href="4-sg.html#SP6" class="function-link"><span class="function-syntax">Geometry::vec_eq</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">SE_vector</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">)] = </span><span class="constant-syntax">EXIT_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">)] |= </span><span class="constant-syntax">LONGNWSE_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">)] = </span><span class="constant-syntax">EXIT_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP5">&#167;5</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_2" class="paragraph-anchor"></a><b>&#167;5.2. </b>That leaves just three bits left to set: meet, crossdoor and crossdot.
The meet bit is used to show that the door on a connection should be plotted
symmetrically between the two rooms it connects. This is easy for the
directions N, S, E and W:
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Apply nuance bits for a rank or file direction</span><span class="named-paragraph-number">5.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">from</span><span class="plain-syntax"> == </span><span class="identifier-syntax">to</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">from</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">ADJACENT_MAPBIT</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">from</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">DOOR2_MAPBIT</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">from_i1</span><span class="plain-syntax">, </span><span class="identifier-syntax">from_i2</span><span class="plain-syntax">)] |= </span><span class="constant-syntax">MEET_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">Q</span><span class="plain-syntax">, </span><span class="identifier-syntax">to_i1</span><span class="plain-syntax">, </span><span class="identifier-syntax">to_i2</span><span class="plain-syntax">)] |= </span><span class="constant-syntax">MEET_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP5">&#167;5</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_3" class="paragraph-anchor"></a><b>&#167;5.3. </b>But the case of a diagonal direction is much harder, because we may need
to add cornice-pieces. There are four possible diagonal directions (NE, NW,
SE and SW), and in each case the origin \(P\) and the neighbour cell \(P+D\)
must live in opposite corners of a \(2\times 2\) box of cells. We set \(N\)
to the bottom left cell of this box (which might be one of the two cells
we were originally looking at, or might be one of the other two).
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Apply nuance bits for a diagonal direction</span><span class="named-paragraph-number">5.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">vector</span><span class="plain-syntax"> </span><span class="identifier-syntax">N</span><span class="plain-syntax"> = </span><span class="identifier-syntax">P</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">D</span><span class="plain-syntax">.</span><span class="element-syntax">x</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">N</span><span class="plain-syntax">.</span><span class="element-syntax">x</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">D</span><span class="plain-syntax">.</span><span class="identifier-syntax">y</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">N</span><span class="plain-syntax">.</span><span class="identifier-syntax">y</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP6" class="function-link"><span class="function-syntax">HTMLMap::correct_diagonal</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP6" class="function-link"><span class="function-syntax">HTMLMap::correct_diagonal</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP5">&#167;5</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b>So now the vector \(BL\) represents the bottom left cell (i.e., the southwestern
corner of the box). We can obtain the other three cells of the \(2\times 2\) box
by offsetting to N, E and NE. Two of these cells form the diagonal of the
map connection (are "used"), and two are off-diagonal (are "unused").
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::correct_diagonal</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">HTMLMap::correct_diagonal</span></span>:<br/><a href="4-rhm.html#SP5_3">&#167;5.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">vector</span><span class="plain-syntax"> </span><span class="identifier-syntax">BL</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">SW_to_NE</span><span class="plain-syntax">, </span><span class="reserved-syntax">index_session</span><span class="plain-syntax"> *</span><span class="identifier-syntax">session</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">pos_00</span><span class="plain-syntax">, </span><span class="comment-syntax"> corner icon position of lower cell used by the map connection</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pos_01</span><span class="plain-syntax">, </span><span class="comment-syntax"> corner icon position of lower cell not used by the map connection</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pos_10</span><span class="plain-syntax">, </span><span class="comment-syntax"> corner icon position of upper cell not used by the map connection</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pos_11</span><span class="plain-syntax">; </span><span class="comment-syntax"> corner icon position of upper cell used by the map connection</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">SW_to_NE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pos_00</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">BL</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pos_01</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><a href="4-sg.html#SP7" class="function-link"><span class="function-syntax">Geometry::vec_plus</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">BL</span><span class="plain-syntax">, </span><span class="identifier-syntax">N_vector</span><span class="plain-syntax">), </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pos_10</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><a href="4-sg.html#SP7" class="function-link"><span class="function-syntax">Geometry::vec_plus</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">BL</span><span class="plain-syntax">, </span><span class="identifier-syntax">E_vector</span><span class="plain-syntax">), </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pos_11</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><a href="4-sg.html#SP7" class="function-link"><span class="function-syntax">Geometry::vec_plus</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">BL</span><span class="plain-syntax">, </span><span class="identifier-syntax">NE_vector</span><span class="plain-syntax">), </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pos_00</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><a href="4-sg.html#SP7" class="function-link"><span class="function-syntax">Geometry::vec_plus</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">BL</span><span class="plain-syntax">, </span><span class="identifier-syntax">E_vector</span><span class="plain-syntax">), </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pos_01</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><a href="4-sg.html#SP7" class="function-link"><span class="function-syntax">Geometry::vec_plus</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">BL</span><span class="plain-syntax">, </span><span class="identifier-syntax">NE_vector</span><span class="plain-syntax">), </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pos_10</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">BL</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pos_11</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><a href="4-sg.html#SP7" class="function-link"><span class="function-syntax">Geometry::vec_plus</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">BL</span><span class="plain-syntax">, </span><span class="identifier-syntax">N_vector</span><span class="plain-syntax">), </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP6_1" class="named-paragraph-link"><span class="named-paragraph">Set the relevant bits to support a door, if there is one</span><span class="named-paragraph-number">6.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP6_2" class="named-paragraph-link"><span class="named-paragraph">Set the relevant bits to put mortice into the notches in a long diagonal</span><span class="named-paragraph-number">6.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6_1" class="paragraph-anchor"></a><b>&#167;6.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Set the relevant bits to support a door, if there is one</span><span class="named-paragraph-number">6.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">from</span><span class="plain-syntax"> = </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">pos_00</span><span class="plain-syntax">], </span><span class="identifier-syntax">to</span><span class="plain-syntax"> = </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">pos_11</span><span class="plain-syntax">];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">from</span><span class="plain-syntax"> == </span><span class="identifier-syntax">to</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">from</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">ADJACENT_MAPBIT</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">from</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">DOOR2_MAPBIT</span><span class="plain-syntax">) &amp;&amp; ((</span><span class="identifier-syntax">from</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">MEET_MAPBIT</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">pos_01</span><span class="plain-syntax">] == </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">pos_10</span><span class="plain-syntax">] == </span><span class="constant-syntax">0</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP6_1_1" class="named-paragraph-link"><span class="named-paragraph">Make a large, athwart door from icons in all four cells</span><span class="named-paragraph-number">6.1.1</span></a></span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP6_1_2" class="named-paragraph-link"><span class="named-paragraph">Make a small door from icons in just the two used cells</span><span class="named-paragraph-number">6.1.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_1_1" class="paragraph-anchor"></a><b>&#167;6.1.1. </b>If the off-diagonal cells happen to be free, we can use them to draw a nice
large door which is exactly halfway between the two rooms it connects, and
is perpendicular to the direction of the map connection.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Make a large, athwart door from icons in all four cells</span><span class="named-paragraph-number">6.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">pos_00</span><span class="plain-syntax">] |= </span><span class="constant-syntax">MEET_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">pos_11</span><span class="plain-syntax">] |= </span><span class="constant-syntax">MEET_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">pos_01</span><span class="plain-syntax">] = </span><span class="constant-syntax">CROSSDOOR_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">pos_10</span><span class="plain-syntax">] = </span><span class="constant-syntax">CROSSDOOR_MAPBIT</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP6_1">&#167;6.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_1_2" class="paragraph-anchor"></a><b>&#167;6.1.2. </b>But if the off-diagonal cells aren't free, we have no room for that, and
must draw a much smaller door on one end or the other (not both) of the
connection.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Make a small door from icons in just the two used cells</span><span class="named-paragraph-number">6.1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">pos_00</span><span class="plain-syntax">] = </span><span class="constant-syntax">DOOR2_MAPBIT</span><span class="plain-syntax">; </span><span class="comment-syntax"> mark the door on the BL half of the exit</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">pos_11</span><span class="plain-syntax">] = </span><span class="constant-syntax">EXIT_MAPBIT</span><span class="plain-syntax">; </span><span class="comment-syntax"> with no door on the other half of the exit</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP6_1">&#167;6.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_2" class="paragraph-anchor"></a><b>&#167;6.2. </b>If the off-diagonal cells happen to be free, we can put little single-pixel
icons into them to repair the notches which would otherwise show when the
map connection stripe (3 pixels wide) passes through a cell corner.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Set the relevant bits to put mortice into the notches in a long diagonal</span><span class="named-paragraph-number">6.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">from</span><span class="plain-syntax"> = </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">pos_00</span><span class="plain-syntax">], </span><span class="identifier-syntax">to</span><span class="plain-syntax"> = </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">pos_11</span><span class="plain-syntax">];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">from</span><span class="plain-syntax"> == </span><span class="identifier-syntax">to</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">from</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">CONNECTIVE_BITMAP</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">pos_01</span><span class="plain-syntax">] == </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">pos_10</span><span class="plain-syntax">] == </span><span class="constant-syntax">0</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">pos_01</span><span class="plain-syntax">] = </span><span class="constant-syntax">CROSSDOT_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">pos_10</span><span class="plain-syntax">] = </span><span class="constant-syntax">CROSSDOT_MAPBIT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. Nested HTML Tables.</b>In 2010 it is considered something of a heresy to be still doing web page
layout using nested tables - supposedly, CSS is now strong enough for all
our needs - but the map is unusually well suited to a table approach since
it consists, in the end, of tessellations of rectangles.
</p>

<p class="commentary">Here's the code we will use to create each HTML table.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">map_tables_begun</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::begin_variable_width_table</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">HTMLMap::begin_variable_width_table</span></span>:<br/><a href="4-rhm.html#SP11_1">&#167;11.1</a>, <a href="4-rhm.html#SP14_2_2_1">&#167;14.2.2.1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP7_1" class="named-paragraph-link"><span class="named-paragraph">Include some indentation for a new map table</span><span class="named-paragraph-number">7.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">map_tables_begun</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::begin_html_table</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::begin_map_table</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">HTMLMap::begin_map_table</span></span>:<br/><a href="4-rhm.html#SP14_1">&#167;14.1</a>, <a href="4-rhm.html#SP14_2_1_1">&#167;14.2.1.1</a>, <a href="4-rhm.html#SP14_2_2_1">&#167;14.2.2.1</a>, <a href="4-rhm.html#SP14_2_3_1">&#167;14.2.3.1</a>, <a href="4-rhm.html#SP14_2_1_2">&#167;14.2.1.2</a>, <a href="4-rhm.html#SP14_2_2_2">&#167;14.2.2.2</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">width</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">height</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP7_1" class="named-paragraph-link"><span class="named-paragraph">Include some indentation for a new map table</span><span class="named-paragraph-number">7.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">map_tables_begun</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::begin_html_table</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">height</span><span class="plain-syntax">, </span><span class="identifier-syntax">width</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::begin_variable_width_table_with_background</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">HTMLMap::begin_variable_width_table_with_background</span></span>:<br/><a href="4-rhm.html#SP14">&#167;14</a>, <a href="4-rhm.html#SP14_1">&#167;14.1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">char</span><span class="plain-syntax"> *</span><span class="identifier-syntax">bg_image</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP7_1" class="named-paragraph-link"><span class="named-paragraph">Include some indentation for a new map table</span><span class="named-paragraph-number">7.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">map_tables_begun</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">img</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">img</span><span class="plain-syntax">, </span><span class="string-syntax">"map_icons/%s"</span><span class="plain-syntax">, </span><span class="identifier-syntax">bg_image</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::begin_html_table_bg</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">img</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">img</span><span class="plain-syntax">)</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. </b>Each table, however begun, concludes with:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::end_map_table</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">HTMLMap::end_map_table</span></span>:<br/><a href="4-rhm.html#SP11_1">&#167;11.1</a>, <a href="4-rhm.html#SP14">&#167;14</a>, <a href="4-rhm.html#SP14_1">&#167;14.1</a>, <a href="4-rhm.html#SP14_2_1_1">&#167;14.2.1.1</a>, <a href="4-rhm.html#SP14_2_2_1">&#167;14.2.2.1</a>, <a href="4-rhm.html#SP14_2_3_1">&#167;14.2.3.1</a>, <a href="4-rhm.html#SP14_2_1_2">&#167;14.2.1.2</a>, <a href="4-rhm.html#SP14_2_2_2">&#167;14.2.2.2</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">map_tables_begun</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP7_1" class="named-paragraph-link"><span class="named-paragraph">Include some indentation for a new map table</span><span class="named-paragraph-number">7.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::end_html_table</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7_1" class="paragraph-anchor"></a><b>&#167;7.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Include some indentation for a new map table</span><span class="named-paragraph-number">7.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">map_tables_begun</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"  "</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP7">&#167;7</a> (three times) and <a href="4-rhm.html#SP8">&#167;8</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. Icon images.</b>The icons we use will all be PNGs, and all stored in the <span class="extract"><span class="extract-syntax">map_icons</span></span>
directory. A "tool tip" is the text which appears over the mouse arrow
when it hovers for long enough over the icon.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::plot_map_icon</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">HTMLMap::plot_map_icon</span></span>:<br/><a href="4-rhm.html#SP14_2_1_1">&#167;14.2.1.1</a>, <a href="4-rhm.html#SP14_2_2_1">&#167;14.2.2.1</a>, <a href="4-rhm.html#SP14_2_2_1_1">&#167;14.2.2.1.1</a>, <a href="4-rhm.html#SP14_2_3_1">&#167;14.2.3.1</a>, <a href="4-rhm.html#SP16_1">&#167;16.1</a>, <a href="4-rhm.html#SP16_2">&#167;16.2</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">icon_name</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_TAG_WITH</span><span class="plain-syntax">(</span><span class="string-syntax">"img"</span><span class="plain-syntax">, </span><span class="string-syntax">"border=0 src=inform:/map_icons/%S.png"</span><span class="plain-syntax">, </span><span class="identifier-syntax">icon_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::plot_map_icon_with_tip</span><button class="popup" onclick="togglePopup('usagePopup9')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup9">Usage of <span class="code-font"><span class="function-syntax">HTMLMap::plot_map_icon_with_tip</span></span>:<br/><a href="4-rhm.html#SP16_2">&#167;16.2</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">icon_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tool_tip</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_TAG_WITH</span><span class="plain-syntax">(</span><span class="string-syntax">"img"</span><span class="plain-syntax">, </span><span class="string-syntax">"border=0 src=inform:/map_icons/%S.png %S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">icon_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">tool_tip</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. Room colours.</b>We give different colours to the first 20 regions defined, then repeat
the cycle for the next 20, and so on. (It's unlikely that there are that
many regions, but even if there are, regions 20 apart are unlikely to come
into contact, since they would be created in source text a long way distant
from each other.)
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">NO_REGION_COLOURS</span><span class="plain-syntax"> </span><span class="constant-syntax">20</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::compute_room_colours</span><button class="popup" onclick="togglePopup('usagePopup10')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup10">Usage of <span class="code-font"><span class="function-syntax">HTMLMap::compute_room_colours</span></span>:<br/><a href="4-rhm.html#SP11">&#167;11</a><br/>Render EPS Map - <a href="4-rem.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">index_session</span><span class="plain-syntax"> *</span><span class="identifier-syntax">session</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">faux_instance_set</span><span class="plain-syntax"> *</span><span class="identifier-syntax">faux_set</span><span class="plain-syntax"> = </span><a href="1-ia.html#SP12" class="function-link"><span class="function-syntax">Indexing::get_set_of_instances</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inchar32_t</span><span class="plain-syntax"> *</span><span class="identifier-syntax">some_map_colours</span><span class="plain-syntax">[</span><span class="constant-syntax">NO_REGION_COLOURS</span><span class="plain-syntax">] = {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"Pale Green"</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"Light Blue"</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"Plum"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"Light Sea Green"</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"Light Slate Blue"</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"Navajo White"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"Violet Red"</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"Light Cyan"</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"Light Coral"</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"Light Pink"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"Medium Aquamarine"</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"Medium Blue"</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"Medium Orchid"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"Medium Purple"</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"Medium Sea Green"</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"Medium Slate Blue"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"Medium Spring Green"</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"Medium Turquoise"</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"Medium Violet Red"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"Light Golden Rod Yellow"</span><span class="plain-syntax"> };</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">RG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">regc</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_FAUX_REGIONS</span><span class="plain-syntax">(</span><span class="identifier-syntax">faux_set</span><span class="plain-syntax">, </span><span class="identifier-syntax">RG</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RG</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">fimd</span><span class="plain-syntax">.</span><span class="element-syntax">colour</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">RG</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">fimd</span><span class="plain-syntax">.</span><span class="element-syntax">colour</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">RG</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">fimd</span><span class="plain-syntax">.</span><span class="element-syntax">colour</span><span class="plain-syntax">, </span><span class="string-syntax">"%w"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">HTML::translate_colour_name</span><span class="plain-syntax">(</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">some_map_colours</span><span class="plain-syntax">[(</span><span class="identifier-syntax">regc</span><span class="plain-syntax">++) % </span><span class="constant-syntax">NO_REGION_COLOURS</span><span class="plain-syntax">]));</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">default_room_col</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">default_room_col</span><span class="plain-syntax">, </span><span class="string-syntax">"%w"</span><span class="plain-syntax">, </span><span class="identifier-syntax">HTML::translate_colour_name</span><span class="plain-syntax">(</span><span class="identifier-syntax">U</span><span class="string-syntax">"Light Grey"</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">R</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_FAUX_ROOMS</span><span class="plain-syntax">(</span><span class="identifier-syntax">faux_set</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">R</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">fimd</span><span class="plain-syntax">.</span><span class="element-syntax">colour</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">reg</span><span class="plain-syntax"> = </span><a href="2-fi.html#SP13" class="function-link"><span class="function-syntax">FauxInstances::region_of</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">reg</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">R</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">fimd</span><span class="plain-syntax">.</span><span class="element-syntax">colour</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">reg</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">fimd</span><span class="plain-syntax">.</span><span class="element-syntax">colour</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">R</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">fimd</span><span class="plain-syntax">.</span><span class="element-syntax">colour</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">default_room_col</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. The major map.</b>Note that we check to see if there is more than one room in the world: if
there isn't, we don't bother with a full map, but we still calculate as far
as the icon grid in order to be sure that the little 1 by 1 map for it (in
the details part of the World Index page) will be all right.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::render_map_as_HTML</span><button class="popup" onclick="togglePopup('usagePopup11')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup11">Usage of <span class="code-font"><span class="function-syntax">HTMLMap::render_map_as_HTML</span></span>:<br/>Map Element - <a href="3-me.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">index_session</span><span class="plain-syntax"> *</span><span class="identifier-syntax">session</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">localisation_dictionary</span><span class="plain-syntax"> *</span><span class="identifier-syntax">LD</span><span class="plain-syntax"> = </span><a href="1-ia.html#SP10" class="function-link"><span class="function-syntax">Indexing::get_localisation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">faux_instance_set</span><span class="plain-syntax"> *</span><span class="identifier-syntax">faux_set</span><span class="plain-syntax"> = </span><a href="1-ia.html#SP12" class="function-link"><span class="function-syntax">Indexing::get_set_of_instances</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP1" class="function-link"><span class="function-syntax">HTMLMap::calculate_map_grid</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP10" class="function-link"><span class="function-syntax">HTMLMap::compute_room_colours</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-fi.html#SP12" class="function-link"><span class="function-syntax">FauxInstances::no_rooms</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">session</span><span class="plain-syntax">) &gt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML::comment</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"WORLD WRITE MAP BEGINS"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"p"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP11_1" class="named-paragraph-link"><span class="named-paragraph">Draw an HTML map for the whole Universe of rooms</span><span class="named-paragraph-number">11.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"p"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML::comment</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"WORLD WRITE MAP ENDS"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11_1" class="paragraph-anchor"></a><b>&#167;11.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Draw an HTML map for the whole Universe of rooms</span><span class="named-paragraph-number">11.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><a href="4-rhm.html#SP7" class="function-link"><span class="function-syntax">HTMLMap::begin_variable_width_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">z</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">z</span><span class="plain-syntax">=</span><span class="identifier-syntax">session</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">calc</span><span class="plain-syntax">.</span><span class="element-syntax">Universe</span><span class="plain-syntax">.</span><span class="element-syntax">corner1</span><span class="plain-syntax">.</span><span class="identifier-syntax">z</span><span class="plain-syntax">; </span><span class="identifier-syntax">z</span><span class="plain-syntax">&gt;=</span><span class="identifier-syntax">session</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">calc</span><span class="plain-syntax">.</span><span class="element-syntax">Universe</span><span class="plain-syntax">.</span><span class="element-syntax">corner0</span><span class="plain-syntax">.</span><span class="identifier-syntax">z</span><span class="plain-syntax">; </span><span class="identifier-syntax">z</span><span class="plain-syntax">--) {</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP11_1_1" class="named-paragraph-link"><span class="named-paragraph">Draw the rubric row which labels this level of the map</span><span class="named-paragraph-number">11.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP11_1_2" class="named-paragraph-link"><span class="named-paragraph">Draw this level of the map</span><span class="named-paragraph-number">11.1.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP11_1_3" class="named-paragraph-link"><span class="named-paragraph">Draw the baseline rubric row which concludes the map</span><span class="named-paragraph-number">11.1.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP8" class="function-link"><span class="function-syntax">HTMLMap::end_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP11_1_4" class="named-paragraph-link"><span class="named-paragraph">Add a paragraph describing how non-standard directions are mapped</span><span class="named-paragraph-number">11.1.4</span></a></span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP11">&#167;11</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP11_1_1" class="paragraph-anchor"></a><b>&#167;11.1.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Draw the rubric row which labels this level of the map</span><span class="named-paragraph-number">11.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">level_rubric</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP12" class="function-link"><span class="function-syntax">HTMLMap::devise_level_rubric</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">z</span><span class="plain-syntax">, </span><span class="identifier-syntax">level_rubric</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">); </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">rounding</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">z</span><span class="plain-syntax"> == </span><span class="identifier-syntax">session</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">calc</span><span class="plain-syntax">.</span><span class="element-syntax">Universe</span><span class="plain-syntax">.</span><span class="element-syntax">corner1</span><span class="plain-syntax">.</span><span class="identifier-syntax">z</span><span class="plain-syntax">) </span><span class="identifier-syntax">rounding</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ROUND_BOX_TOP</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::open_coloured_box</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"indexmorebox"</span><span class="plain-syntax">, </span><span class="identifier-syntax">rounding</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;i&gt;%S&lt;/i&gt;"</span><span class="plain-syntax">, </span><span class="identifier-syntax">level_rubric</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::close_coloured_box</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"indexmorebox"</span><span class="plain-syntax">, </span><span class="identifier-syntax">rounding</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">); </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">level_rubric</span><span class="plain-syntax">)</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP11_1">&#167;11.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP11_1_2" class="paragraph-anchor"></a><b>&#167;11.1.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Draw this level of the map</span><span class="named-paragraph-number">11.1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">y_max</span><span class="plain-syntax"> = -1000000000, </span><span class="identifier-syntax">y_min</span><span class="plain-syntax"> = </span><span class="constant-syntax">1000000000</span><span class="plain-syntax">; </span><span class="comment-syntax"> assuming there are fewer than 1 billion rooms</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">R</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_FAUX_ROOMS</span><span class="plain-syntax">(</span><span class="identifier-syntax">faux_set</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Room_position</span><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">).</span><span class="identifier-syntax">z</span><span class="plain-syntax"> == </span><span class="identifier-syntax">z</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Room_position</span><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">).</span><span class="identifier-syntax">y</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">y_min</span><span class="plain-syntax">) </span><span class="identifier-syntax">y_min</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Room_position</span><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">).</span><span class="identifier-syntax">y</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Room_position</span><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">).</span><span class="identifier-syntax">y</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">y_max</span><span class="plain-syntax">) </span><span class="identifier-syntax">y_max</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Room_position</span><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">).</span><span class="identifier-syntax">y</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">y_max</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">y_min</span><span class="plain-syntax">) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">SPATIAL_MAP</span><span class="plain-syntax">, </span><span class="string-syntax">"Level %d has rooms with %d &lt;= y &lt;= %d\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">z</span><span class="plain-syntax">, </span><span class="identifier-syntax">y_min</span><span class="plain-syntax">, </span><span class="identifier-syntax">y_max</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">); </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP14" class="function-link"><span class="function-syntax">HTMLMap::plot_map_level</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">calc</span><span class="plain-syntax">.</span><span class="element-syntax">Universe</span><span class="plain-syntax">.</span><span class="element-syntax">corner0</span><span class="plain-syntax">.</span><span class="element-syntax">x</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">session</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">calc</span><span class="plain-syntax">.</span><span class="element-syntax">Universe</span><span class="plain-syntax">.</span><span class="element-syntax">corner1</span><span class="plain-syntax">.</span><span class="element-syntax">x</span><span class="plain-syntax">, </span><span class="identifier-syntax">y_min</span><span class="plain-syntax">, </span><span class="identifier-syntax">y_max</span><span class="plain-syntax">, </span><span class="identifier-syntax">z</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">); </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">); </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP11_1">&#167;11.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP11_1_3" class="paragraph-anchor"></a><b>&#167;11.1.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Draw the baseline rubric row which concludes the map</span><span class="named-paragraph-number">11.1.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">); </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::open_coloured_box</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"indexmorebox"</span><span class="plain-syntax">, </span><span class="identifier-syntax">ROUND_BOX_BOTTOM</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::close_coloured_box</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"indexmorebox"</span><span class="plain-syntax">, </span><span class="identifier-syntax">ROUND_BOX_BOTTOM</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">); </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP11_1">&#167;11.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP11_1_4" class="paragraph-anchor"></a><b>&#167;11.1.4. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Add a paragraph describing how non-standard directions are mapped</span><span class="named-paragraph-number">11.1.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax">; </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">k</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_FAUX_DIRECTIONS</span><span class="plain-syntax">(</span><span class="identifier-syntax">faux_set</span><span class="plain-syntax">, </span><span class="identifier-syntax">D</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">A</span><span class="plain-syntax"> = </span><a href="4-sm.html#SP11" class="function-link"><span class="function-syntax">SpatialMap::mapped_as_if</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">A</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">k</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">k</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) { </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"p"</span><span class="plain-syntax">); } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"; "</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Localisation::italic_tt</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">LD</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Mp.MappingAs"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><a href="2-fi.html#SP13" class="function-link"><span class="function-syntax">FauxInstances::get_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">), </span><a href="2-fi.html#SP13" class="function-link"><span class="function-syntax">FauxInstances::get_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">k</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) { </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"p"</span><span class="plain-syntax">); }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP11_1">&#167;11.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. Level rubrics.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::devise_level_rubric</span><button class="popup" onclick="togglePopup('usagePopup12')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup12">Usage of <span class="code-font"><span class="function-syntax">HTMLMap::devise_level_rubric</span></span>:<br/><a href="4-rhm.html#SP11_1_1">&#167;11.1.1</a><br/>Render EPS Map - <a href="4-rem.html#SP1_1_2">&#167;1.1.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">z</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">level_rubric</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">index_session</span><span class="plain-syntax"> *</span><span class="identifier-syntax">session</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">localisation_dictionary</span><span class="plain-syntax"> *</span><span class="identifier-syntax">LD</span><span class="plain-syntax"> = </span><a href="1-ia.html#SP10" class="function-link"><span class="function-syntax">Indexing::get_localisation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">key</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Mp.DefaultLevel"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">par</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax">(</span><span class="identifier-syntax">session</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">calc</span><span class="plain-syntax">.</span><span class="element-syntax">Universe</span><span class="plain-syntax">.</span><span class="element-syntax">corner1</span><span class="plain-syntax">.</span><span class="identifier-syntax">z</span><span class="plain-syntax"> - </span><span class="identifier-syntax">session</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">calc</span><span class="plain-syntax">.</span><span class="element-syntax">Universe</span><span class="plain-syntax">.</span><span class="element-syntax">corner0</span><span class="plain-syntax">.</span><span class="identifier-syntax">z</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax">: </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">z</span><span class="plain-syntax"> == </span><span class="identifier-syntax">session</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">calc</span><span class="plain-syntax">.</span><span class="element-syntax">Universe</span><span class="plain-syntax">.</span><span class="element-syntax">corner0</span><span class="plain-syntax">.</span><span class="identifier-syntax">z</span><span class="plain-syntax">) </span><span class="identifier-syntax">key</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Mp.LowerLevel"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">             </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">z</span><span class="plain-syntax"> == </span><span class="identifier-syntax">session</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">calc</span><span class="plain-syntax">.</span><span class="element-syntax">Universe</span><span class="plain-syntax">.</span><span class="element-syntax">corner1</span><span class="plain-syntax">.</span><span class="identifier-syntax">z</span><span class="plain-syntax">) </span><span class="identifier-syntax">key</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Mp.UpperLevel"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">default:</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">z_offset</span><span class="plain-syntax"> = </span><span class="identifier-syntax">z</span><span class="plain-syntax"> - </span><a href="4-sm.html#SP4" class="function-link"><span class="function-syntax">SpatialMap::benchmark_level</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">switch</span><span class="plain-syntax">(</span><span class="identifier-syntax">z_offset</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">:  </span><span class="identifier-syntax">key</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Mp.StartingLevel"</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax">:  </span><span class="identifier-syntax">key</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Mp.FirstLevelUp"</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> -1: </span><span class="identifier-syntax">key</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Mp.FirstLevelDown"</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span><span class="plain-syntax">:  </span><span class="identifier-syntax">key</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Mp.SecondLevelUp"</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> -2: </span><span class="identifier-syntax">key</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Mp.SecondLevelDown"</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span><span class="plain-syntax">:  </span><span class="identifier-syntax">key</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Mp.ThirdLevelUp"</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> -3: </span><span class="identifier-syntax">key</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Mp.ThirdLevelDown"</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">default:</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">z_offset</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">par</span><span class="plain-syntax"> = </span><span class="identifier-syntax">z_offset</span><span class="plain-syntax">; </span><span class="identifier-syntax">key</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Mp.LevelUp"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">z_offset</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">par</span><span class="plain-syntax"> = -</span><span class="identifier-syntax">z_offset</span><span class="plain-syntax">; </span><span class="identifier-syntax">key</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Mp.LevelDown"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Localisation::roman_i</span><span class="plain-syntax">(</span><span class="identifier-syntax">level_rubric</span><span class="plain-syntax">, </span><span class="identifier-syntax">LD</span><span class="plain-syntax">, </span><span class="identifier-syntax">key</span><span class="plain-syntax">, </span><span class="identifier-syntax">par</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP13" class="paragraph-anchor"></a><b>&#167;13. Single-room submaps.</b>The following provides the "details" portion of the World index: there
are two columns, the first containing a \(1\times 1\) submap of just the
room in question, the second containing its indexing details.
</p>

<p class="commentary">This will only work if the main routine above has already been called, so
that the grids are calculated, the region colours decided, and so on.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::render_single_room_as_HTML</span><button class="popup" onclick="togglePopup('usagePopup13')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup13">Usage of <span class="code-font"><span class="function-syntax">HTMLMap::render_single_room_as_HTML</span></span>:<br/>Map Element - <a href="3-me.html#SP1_2">&#167;1.2</a>, <a href="3-me.html#SP1_3">&#167;1.3</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">R</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">index_session</span><span class="plain-syntax"> *</span><span class="identifier-syntax">session</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"p"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-iu.html#SP5" class="function-link"><span class="function-syntax">IndexUtilities::anchor</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">anchor_text</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_TAG_WITH</span><span class="plain-syntax">(</span><span class="string-syntax">"a"</span><span class="plain-syntax">, </span><span class="string-syntax">"name=wo_%d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">allocation_id</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::begin_plain_html_table</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::first_html_column</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">vector</span><span class="plain-syntax"> </span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Room_position</span><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP14" class="function-link"><span class="function-syntax">HTMLMap::plot_map_level</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">.</span><span class="element-syntax">x</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">.</span><span class="element-syntax">x</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">.</span><span class="identifier-syntax">y</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">.</span><span class="identifier-syntax">y</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">.</span><span class="identifier-syntax">z</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::next_html_column</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&amp;nbsp;"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::next_html_column</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-me.html#SP2" class="function-link"><span class="function-syntax">MapElement::index</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::end_html_row</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::end_html_table</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"p"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP14" class="paragraph-anchor"></a><b>&#167;14. Plotting a rectangle of the map.</b>Either way, then, we end up calling the following routine, which plots a
map of a rectangular X-Y area at a given fixed Z coordinate. The pass is 1
for the main mapping, 2 for single-room-only mapping lower down on the
index page.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::plot_map_level</span><button class="popup" onclick="togglePopup('usagePopup14')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup14">Usage of <span class="code-font"><span class="function-syntax">HTMLMap::plot_map_level</span></span>:<br/><a href="4-rhm.html#SP11_1_2">&#167;11.1.2</a>, <a href="4-rhm.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">x0</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">x1</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">y0</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">y1</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">z</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="reserved-syntax">index_session</span><span class="plain-syntax"> *</span><span class="identifier-syntax">session</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pass</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">SPATIAL_MAP</span><span class="plain-syntax">, </span><span class="string-syntax">"Plot: [%d, %d] x [%d, %d] x {%d}\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">x0</span><span class="plain-syntax">, </span><span class="identifier-syntax">x1</span><span class="plain-syntax">, </span><span class="identifier-syntax">y0</span><span class="plain-syntax">, </span><span class="identifier-syntax">y1</span><span class="plain-syntax">, </span><span class="identifier-syntax">z</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">with_numbering</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">pass</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">session</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">calc</span><span class="plain-syntax">.</span><span class="element-syntax">Universe</span><span class="plain-syntax">.</span><span class="element-syntax">corner1</span><span class="plain-syntax">.</span><span class="identifier-syntax">z</span><span class="plain-syntax"> != </span><span class="identifier-syntax">session</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">calc</span><span class="plain-syntax">.</span><span class="element-syntax">Universe</span><span class="plain-syntax">.</span><span class="element-syntax">corner0</span><span class="plain-syntax">.</span><span class="identifier-syntax">z</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">with_numbering</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP7" class="function-link"><span class="function-syntax">HTMLMap::begin_variable_width_table_with_background</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="string-syntax">"grid.png"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">y</span><span class="plain-syntax">, </span><span class="identifier-syntax">just_dislocated</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">y</span><span class="plain-syntax">=</span><span class="identifier-syntax">y1</span><span class="plain-syntax">; </span><span class="identifier-syntax">y</span><span class="plain-syntax">&gt;=</span><span class="identifier-syntax">y0</span><span class="plain-syntax">; </span><span class="identifier-syntax">y</span><span class="plain-syntax">--) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax">, </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">x</span><span class="plain-syntax">=</span><span class="identifier-syntax">x0</span><span class="plain-syntax">; </span><span class="identifier-syntax">x</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">x1</span><span class="plain-syntax">; </span><span class="identifier-syntax">x</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">room_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ROOM_GRID_POS</span><span class="plain-syntax">(</span><a href="4-sg.html#SP5" class="function-link"><span class="function-syntax">Geometry::vec</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">x</span><span class="plain-syntax">, </span><span class="identifier-syntax">y</span><span class="plain-syntax">, </span><span class="identifier-syntax">z</span><span class="plain-syntax">))])</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">c</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">just_dislocated</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">just_dislocated</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP14_1" class="named-paragraph-link"><span class="named-paragraph">Render a row of grid dislocation icons</span><span class="named-paragraph-number">14.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">just_dislocated</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP14_2" class="named-paragraph-link"><span class="named-paragraph">Render a row of map cells</span><span class="named-paragraph-number">14.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP8" class="function-link"><span class="function-syntax">HTMLMap::end_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP15" class="paragraph-anchor"></a><b>&#167;15. </b>Cells in the map as drawn are divided into three stripes. The top stripe
contains the icons for the NW, N, NE exits, the middle stripe the icon for W,
then the central square, then the icon for E, and the bottom stripe the three
icons for SW, S, SE exits. We can therefore divide the pixel width of a cell
as \(x_o + x_i + x_o\), where \(x_i\) is the width of the central square.
</p>

<p class="commentary">It follows that any icon to be plotted in the four corner positions must
be square and have pixel dimensions \(x_o\times x_o\); icons for the E and W
exit positions are \(x_o\times x_i\); icons for the N and S positions are
\(x_i\times x_o\); and the central square is, of course, \(x_i\times x_i\),
though in fact we don't plot an image there.
</p>

<p class="commentary">The grid background must have pixel dimensions \((2x_o+x_i)\times (2x_o+x_i)\).
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">MAP_CELL_OUTER_SIZE</span><span class="plain-syntax"> </span><span class="constant-syntax">13</span><span class="plain-syntax"> </span><span class="comment-syntax"> i.e., </span>\(x_o\)
<span class="definition-keyword">define</span> <span class="constant-syntax">MAP_CELL_INNER_SIZE</span><span class="plain-syntax"> </span><span class="constant-syntax">27</span><span class="plain-syntax"> </span><span class="comment-syntax"> i.e., </span>\(x_i\)
<span class="definition-keyword">define</span> <span class="constant-syntax">MAP_CELL_SIZE</span><span class="plain-syntax"> (</span><span class="constant-syntax">MAP_CELL_OUTER_SIZE</span><span class="plain-syntax"> + </span><span class="constant-syntax">MAP_CELL_INNER_SIZE</span><span class="plain-syntax"> + </span><span class="constant-syntax">MAP_CELL_OUTER_SIZE</span><span class="plain-syntax">)</span>
</pre>
<p class="commentary firstcommentary"><a id="SP14_1" class="paragraph-anchor"></a><b>&#167;14.1. </b>This is going to be a height-19 blank row of a table with a different
background image to the regular grid background &mdash; it's an icon of the grid
with breaks in it. So we need to end the existing table, start a new one,
end it again, and start another table like the original.
</p>

<p class="commentary">The cells in a dislocation row have the usual width, but a foreshortened
height, and they're drawn with a single stripe.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">MAP_DISLOCATION_HEIGHT</span><span class="plain-syntax"> </span><span class="constant-syntax">19</span><span class="plain-syntax"> </span><span class="comment-syntax"> the reduced height</span>
</pre>
<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Render a row of grid dislocation icons</span><span class="named-paragraph-number">14.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><a href="4-rhm.html#SP8" class="function-link"><span class="function-syntax">HTMLMap::end_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP7" class="function-link"><span class="function-syntax">HTMLMap::begin_variable_width_table_with_background</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="string-syntax">"dislocation.png"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">cells</span><span class="plain-syntax"> = </span><span class="identifier-syntax">x1</span><span class="plain-syntax">-</span><span class="identifier-syntax">x0</span><span class="plain-syntax">+1;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">with_numbering</span><span class="plain-syntax">) </span><span class="identifier-syntax">cells</span><span class="plain-syntax"> += </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">cells</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">); </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP7" class="function-link"><span class="function-syntax">HTMLMap::begin_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">MAP_CELL_SIZE</span><span class="plain-syntax">, </span><span class="constant-syntax">MAP_DISLOCATION_HEIGHT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">); </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">); </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">); </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP8" class="function-link"><span class="function-syntax">HTMLMap::end_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP8" class="function-link"><span class="function-syntax">HTMLMap::end_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP7" class="function-link"><span class="function-syntax">HTMLMap::begin_variable_width_table_with_background</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="string-syntax">"grid.png"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP14">&#167;14</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP14_2" class="paragraph-anchor"></a><b>&#167;14.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Render a row of map cells</span><span class="named-paragraph-number">14.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP14_2_1" class="named-paragraph-link"><span class="named-paragraph">Render the top stripe of the map row</span><span class="named-paragraph-number">14.2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP14_2_2" class="named-paragraph-link"><span class="named-paragraph">Render the middle stripe of the map row</span><span class="named-paragraph-number">14.2.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP14_2_3" class="named-paragraph-link"><span class="named-paragraph">Render the bottom stripe of the map row</span><span class="named-paragraph-number">14.2.3</span></a></span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP14">&#167;14</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP14_2_1" class="paragraph-anchor"></a><b>&#167;14.2.1. </b>The top stripe has height \(x_o\).
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Render the top stripe of the map row</span><span class="named-paragraph-number">14.2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">with_numbering</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP14_2_1_2" class="named-paragraph-link"><span class="named-paragraph">Render a top or bottom stripe for a blank cell</span><span class="named-paragraph-number">14.2.1.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">x</span><span class="plain-syntax">=</span><span class="identifier-syntax">x0</span><span class="plain-syntax">; </span><span class="identifier-syntax">x</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">x1</span><span class="plain-syntax">; </span><span class="identifier-syntax">x</span><span class="plain-syntax">++) </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP14_2_1_1" class="named-paragraph-link"><span class="named-paragraph">Render a top stripe for a substantive cell</span><span class="named-paragraph-number">14.2.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">with_numbering</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP14_2_1_2" class="named-paragraph-link"><span class="named-paragraph">Render a top or bottom stripe for a blank cell</span><span class="named-paragraph-number">14.2.1.2</span></a></span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP14_2">&#167;14.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP14_2_2" class="paragraph-anchor"></a><b>&#167;14.2.2. </b>The middle stripe has height \(x_i\).
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Render the middle stripe of the map row</span><span class="named-paragraph-number">14.2.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">with_numbering</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP14_2_2_2" class="named-paragraph-link"><span class="named-paragraph">Render a middle stripe for a numbering cell</span><span class="named-paragraph-number">14.2.2.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">x</span><span class="plain-syntax">=</span><span class="identifier-syntax">x0</span><span class="plain-syntax">; </span><span class="identifier-syntax">x</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">x1</span><span class="plain-syntax">; </span><span class="identifier-syntax">x</span><span class="plain-syntax">++) </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP14_2_2_1" class="named-paragraph-link"><span class="named-paragraph">Render a middle stripe for a substantive cell</span><span class="named-paragraph-number">14.2.2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">with_numbering</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP14_2_2_2" class="named-paragraph-link"><span class="named-paragraph">Render a middle stripe for a numbering cell</span><span class="named-paragraph-number">14.2.2.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP14_2">&#167;14.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP14_2_3" class="paragraph-anchor"></a><b>&#167;14.2.3. </b>The bottom stripe has height \(x_o\).
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Render the bottom stripe of the map row</span><span class="named-paragraph-number">14.2.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">with_numbering</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP14_2_1_2" class="named-paragraph-link"><span class="named-paragraph">Render a top or bottom stripe for a blank cell</span><span class="named-paragraph-number">14.2.1.2</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">x</span><span class="plain-syntax">=</span><span class="identifier-syntax">x0</span><span class="plain-syntax">; </span><span class="identifier-syntax">x</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">x1</span><span class="plain-syntax">; </span><span class="identifier-syntax">x</span><span class="plain-syntax">++) </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP14_2_3_1" class="named-paragraph-link"><span class="named-paragraph">Render a bottom stripe for a substantive cell</span><span class="named-paragraph-number">14.2.3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">with_numbering</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP14_2_1_2" class="named-paragraph-link"><span class="named-paragraph">Render a top or bottom stripe for a blank cell</span><span class="named-paragraph-number">14.2.1.2</span></a></span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP14_2">&#167;14.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP14_2_1_1" class="paragraph-anchor"></a><b>&#167;14.2.1.1. Substantive cells.</b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Render a top stripe for a substantive cell</span><span class="named-paragraph-number">14.2.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">vector</span><span class="plain-syntax"> </span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><a href="4-sg.html#SP5" class="function-link"><span class="function-syntax">Geometry::vec</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">x</span><span class="plain-syntax">, </span><span class="identifier-syntax">y</span><span class="plain-syntax">, </span><span class="identifier-syntax">z</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP7" class="function-link"><span class="function-syntax">HTMLMap::begin_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">MAP_CELL_SIZE</span><span class="plain-syntax">, </span><span class="constant-syntax">MAP_CELL_OUTER_SIZE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP16" class="function-link"><span class="function-syntax">HTMLMap::plot_map_cell</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">)] &amp; </span><span class="constant-syntax">CONNECTIVE_BITMAP</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"s_dot"</span><span class="plain-syntax">); </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"ns_spacer"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP16" class="function-link"><span class="function-syntax">HTMLMap::plot_map_cell</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">8</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP16" class="function-link"><span class="function-syntax">HTMLMap::plot_map_cell</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP16" class="function-link"><span class="function-syntax">HTMLMap::plot_map_cell</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">3</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, -1, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">)] &amp; </span><span class="constant-syntax">CONNECTIVE_BITMAP</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"s_dot"</span><span class="plain-syntax">); </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"ns_spacer"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP16" class="function-link"><span class="function-syntax">HTMLMap::plot_map_cell</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP8" class="function-link"><span class="function-syntax">HTMLMap::end_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP14_2_1">&#167;14.2.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP14_2_2_1" class="paragraph-anchor"></a><b>&#167;14.2.2.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Render a middle stripe for a substantive cell</span><span class="named-paragraph-number">14.2.2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">vector</span><span class="plain-syntax"> </span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><a href="4-sg.html#SP5" class="function-link"><span class="function-syntax">Geometry::vec</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">x</span><span class="plain-syntax">, </span><span class="identifier-syntax">y</span><span class="plain-syntax">, </span><span class="identifier-syntax">z</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP7" class="function-link"><span class="function-syntax">HTMLMap::begin_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">MAP_CELL_SIZE</span><span class="plain-syntax">, </span><span class="constant-syntax">MAP_CELL_INNER_SIZE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP7" class="function-link"><span class="function-syntax">HTMLMap::begin_variable_width_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">)] &amp; </span><span class="constant-syntax">CONNECTIVE_BITMAP</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"e_dot"</span><span class="plain-syntax">); </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"ew_spacer"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_TAG</span><span class="plain-syntax">(</span><span class="string-syntax">"br"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP16" class="function-link"><span class="function-syntax">HTMLMap::plot_map_cell</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">, </span><span class="constant-syntax">11</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_TAG</span><span class="plain-syntax">(</span><span class="string-syntax">"br"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP16" class="function-link"><span class="function-syntax">HTMLMap::plot_map_cell</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">7</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_TAG</span><span class="plain-syntax">(</span><span class="string-syntax">"br"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP16" class="function-link"><span class="function-syntax">HTMLMap::plot_map_cell</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">3</span><span class="plain-syntax">, -1, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_TAG</span><span class="plain-syntax">(</span><span class="string-syntax">"br"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">)] &amp; </span><span class="constant-syntax">CONNECTIVE_BITMAP</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"e_dot"</span><span class="plain-syntax">); </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"ew_spacer"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP8" class="function-link"><span class="function-syntax">HTMLMap::end_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP14_2_2_1_1" class="named-paragraph-link"><span class="named-paragraph">Render the central square for a substantive cell</span><span class="named-paragraph-number">14.2.2.1.1</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP7" class="function-link"><span class="function-syntax">HTMLMap::begin_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">MAP_CELL_OUTER_SIZE</span><span class="plain-syntax">, </span><span class="constant-syntax">MAP_CELL_INNER_SIZE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">)] &amp; </span><span class="constant-syntax">CONNECTIVE_BITMAP</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"w_dot"</span><span class="plain-syntax">); </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"ew_spacer"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_TAG</span><span class="plain-syntax">(</span><span class="string-syntax">"br"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP16" class="function-link"><span class="function-syntax">HTMLMap::plot_map_cell</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">, -1, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_TAG</span><span class="plain-syntax">(</span><span class="string-syntax">"br"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP16" class="function-link"><span class="function-syntax">HTMLMap::plot_map_cell</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">6</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_TAG</span><span class="plain-syntax">(</span><span class="string-syntax">"br"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP16" class="function-link"><span class="function-syntax">HTMLMap::plot_map_cell</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">3</span><span class="plain-syntax">, </span><span class="constant-syntax">10</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_TAG</span><span class="plain-syntax">(</span><span class="string-syntax">"br"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">)] &amp; </span><span class="constant-syntax">CONNECTIVE_BITMAP</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"w_dot"</span><span class="plain-syntax">); </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"ew_spacer"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP8" class="function-link"><span class="function-syntax">HTMLMap::end_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP8" class="function-link"><span class="function-syntax">HTMLMap::end_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP14_2_2">&#167;14.2.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP14_2_2_1_1" class="paragraph-anchor"></a><b>&#167;14.2.2.1.1. </b>The centre of a cell might be a room, or it might be an icon showing the
continuation of one or more long connections running through this cell.
There are 15 possibilities, and their icons are named as the following shows:
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Render the central square for a substantive cell</span><span class="named-paragraph-number">14.2.2.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">bits</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">)]) &amp; </span><span class="constant-syntax">LONGS_BITMAP</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bits</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP17" class="function-link"><span class="function-syntax">HTMLMap::index_room_square</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">room_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ROOM_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">)], </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">icon_name</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">icon_name</span><span class="plain-syntax">, </span><span class="string-syntax">"long"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bits</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">LONGEW_MAPBIT</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">icon_name</span><span class="plain-syntax">, </span><span class="string-syntax">"_ew"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bits</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">LONGNS_MAPBIT</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">icon_name</span><span class="plain-syntax">, </span><span class="string-syntax">"_ns"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bits</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">LONGSWNE_MAPBIT</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">icon_name</span><span class="plain-syntax">, </span><span class="string-syntax">"_swne"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bits</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">LONGNWSE_MAPBIT</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">icon_name</span><span class="plain-syntax">, </span><span class="string-syntax">"_nwse"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">icon_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">icon_name</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP14_2_2_1">&#167;14.2.2.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP14_2_3_1" class="paragraph-anchor"></a><b>&#167;14.2.3.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Render a bottom stripe for a substantive cell</span><span class="named-paragraph-number">14.2.3.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">vector</span><span class="plain-syntax"> </span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><a href="4-sg.html#SP5" class="function-link"><span class="function-syntax">Geometry::vec</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">x</span><span class="plain-syntax">, </span><span class="identifier-syntax">y</span><span class="plain-syntax">, </span><span class="identifier-syntax">z</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP7" class="function-link"><span class="function-syntax">HTMLMap::begin_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">MAP_CELL_SIZE</span><span class="plain-syntax">, </span><span class="constant-syntax">MAP_CELL_OUTER_SIZE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP16" class="function-link"><span class="function-syntax">HTMLMap::plot_map_cell</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">5</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">)] &amp; </span><span class="constant-syntax">CONNECTIVE_BITMAP</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"n_dot"</span><span class="plain-syntax">); </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"ns_spacer"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP16" class="function-link"><span class="function-syntax">HTMLMap::plot_map_cell</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, -1, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP16" class="function-link"><span class="function-syntax">HTMLMap::plot_map_cell</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">3</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP16" class="function-link"><span class="function-syntax">HTMLMap::plot_map_cell</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">3</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">9</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">)] &amp; </span><span class="constant-syntax">CONNECTIVE_BITMAP</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"n_dot"</span><span class="plain-syntax">); </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"ns_spacer"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP16" class="function-link"><span class="function-syntax">HTMLMap::plot_map_cell</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP8" class="function-link"><span class="function-syntax">HTMLMap::end_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP14_2_3">&#167;14.2.3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP14_2_1_2" class="paragraph-anchor"></a><b>&#167;14.2.1.2. Numbering cells.</b>If we're displaying a numbering in the map, that means there are two
columns &mdash; the first and last &mdash; which don't contain rooms or exits, but
are simply blank except for an italic row number.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Render a top or bottom stripe for a blank cell</span><span class="named-paragraph-number">14.2.1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP7" class="function-link"><span class="function-syntax">HTMLMap::begin_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">MAP_CELL_SIZE</span><span class="plain-syntax">, </span><span class="constant-syntax">MAP_CELL_OUTER_SIZE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP8" class="function-link"><span class="function-syntax">HTMLMap::end_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP14_2_1">&#167;14.2.1</a> (twice) and <a href="4-rhm.html#SP14_2_3">&#167;14.2.3</a> (twice).</li></ul>
<p class="commentary firstcommentary"><a id="SP14_2_2_2" class="paragraph-anchor"></a><b>&#167;14.2.2.2. </b>Note that the row number is with respect to the entire Universe, not to
the current rectangle being rendered. The two aren't the same, because the
rectangle may be for a level in which we've omitted blank rows at the north
and south ends.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Render a middle stripe for a numbering cell</span><span class="named-paragraph-number">14.2.2.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP7" class="function-link"><span class="function-syntax">HTMLMap::begin_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">MAP_CELL_SIZE</span><span class="plain-syntax">, </span><span class="constant-syntax">MAP_CELL_INNER_SIZE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"center"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"i"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::begin_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"indexmaplevelnumbers"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">y</span><span class="plain-syntax">-</span><span class="identifier-syntax">session</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">calc</span><span class="plain-syntax">.</span><span class="element-syntax">Universe</span><span class="plain-syntax">.</span><span class="element-syntax">corner0</span><span class="plain-syntax">.</span><span class="identifier-syntax">y</span><span class="plain-syntax">+1);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::end_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"i"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"center"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP8" class="function-link"><span class="function-syntax">HTMLMap::end_map_table</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP14_2_2">&#167;14.2.2</a> (twice).</li></ul>
<p class="commentary firstcommentary"><a id="SP16" class="paragraph-anchor"></a><b>&#167;16. Plotting the eight exterior icons.</b>That leaves just the low-level routines to handle the nine individual pieces
of the cell. First, the eight cells around the outside:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::plot_map_cell</span><button class="popup" onclick="togglePopup('usagePopup15')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup15">Usage of <span class="code-font"><span class="function-syntax">HTMLMap::plot_map_cell</span></span>:<br/><a href="4-rhm.html#SP14_2_1_1">&#167;14.2.1.1</a>, <a href="4-rhm.html#SP14_2_2_1">&#167;14.2.2.1</a>, <a href="4-rhm.html#SP14_2_3_1">&#167;14.2.3.1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="reserved-syntax">vector</span><span class="plain-syntax"> </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i1</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i2</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">faux_exit</span><span class="plain-syntax">, </span><span class="reserved-syntax">index_session</span><span class="plain-syntax"> *</span><span class="identifier-syntax">session</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">localisation_dictionary</span><span class="plain-syntax"> *</span><span class="identifier-syntax">LD</span><span class="plain-syntax"> = </span><a href="1-ia.html#SP10" class="function-link"><span class="function-syntax">Indexing::get_localisation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">faux_instance_set</span><span class="plain-syntax"> *</span><span class="identifier-syntax">faux_set</span><span class="plain-syntax"> = </span><a href="1-ia.html#SP12" class="function-link"><span class="function-syntax">Indexing::get_set_of_instances</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">bitmap</span><span class="plain-syntax"> = </span><span class="identifier-syntax">icon_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">i1</span><span class="plain-syntax">, </span><span class="identifier-syntax">i2</span><span class="plain-syntax">)];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pass</span><span class="plain-syntax"> == </span><span class="constant-syntax">2</span><span class="plain-syntax">) </span><span class="identifier-syntax">bitmap</span><span class="plain-syntax"> &amp;= </span><span class="constant-syntax">CONNECTIVE_BITMAP</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP16_1" class="named-paragraph-link"><span class="named-paragraph">This map cell is empty</span><span class="named-paragraph-number">16.1</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP16_2" class="named-paragraph-link"><span class="named-paragraph">There's something in this map cell</span><span class="named-paragraph-number">16.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP16_1" class="paragraph-anchor"></a><b>&#167;16.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">This map cell is empty</span><span class="named-paragraph-number">16.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">i1</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">i1</span><span class="plain-syntax"> == </span><span class="constant-syntax">3</span><span class="plain-syntax">)) </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"blank_ns"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">i2</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">i2</span><span class="plain-syntax"> == </span><span class="constant-syntax">3</span><span class="plain-syntax">)) </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"blank_ew"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"blank_square"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP16">&#167;16</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP16_2" class="paragraph-anchor"></a><b>&#167;16.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">There's something in this map cell</span><span class="named-paragraph-number">16.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">exit</span><span class="plain-syntax"> = </span><span class="identifier-syntax">exit_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ICON_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">i1</span><span class="plain-syntax">, </span><span class="identifier-syntax">i2</span><span class="plain-syntax">)];</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">icon_name</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">tool_tip</span><span class="plain-syntax">)</span>

<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP16_2_1" class="named-paragraph-link"><span class="named-paragraph">Compose the icon name for this exit</span><span class="named-paragraph-number">16.2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP16_2_2" class="named-paragraph-link"><span class="named-paragraph">Compose a tool tip for this exit icon</span><span class="named-paragraph-number">16.2.2</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">tool_tip</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon_with_tip</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">icon_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">tool_tip</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><a href="4-rhm.html#SP9" class="function-link"><span class="function-syntax">HTMLMap::plot_map_icon</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">icon_name</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">icon_name</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">tool_tip</span><span class="plain-syntax">)</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP16">&#167;16</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP16_2_1" class="paragraph-anchor"></a><b>&#167;16.2.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Compose the icon name for this exit</span><span class="named-paragraph-number">16.2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">char</span><span class="plain-syntax"> *</span><span class="identifier-syntax">clue</span><span class="plain-syntax"> = </span><a href="4-sm.html#SP20" class="function-link"><span class="function-syntax">SpatialMap::find_icon_label</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">exit</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">clue</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">clue</span><span class="plain-syntax"> = </span><a href="4-sm.html#SP20" class="function-link"><span class="function-syntax">SpatialMap::find_icon_label</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">faux_exit</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">clue</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">clue</span><span class="plain-syntax"> = </span><span class="string-syntax">""</span><span class="plain-syntax">; </span><span class="comment-syntax"> should never happen</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">char</span><span class="plain-syntax"> *</span><span class="identifier-syntax">addendum</span><span class="plain-syntax"> = </span><span class="string-syntax">""</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">DOOR2_MAPBIT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">addendum</span><span class="plain-syntax"> = </span><span class="string-syntax">"_door"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">MEET_MAPBIT</span><span class="plain-syntax">) </span><span class="identifier-syntax">addendum</span><span class="plain-syntax"> = </span><span class="string-syntax">"_door_meet"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">DOOR1_MAPBIT</span><span class="plain-syntax">) </span><span class="identifier-syntax">addendum</span><span class="plain-syntax"> = </span><span class="string-syntax">"_door_blocked"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">CROSSDOOR_MAPBIT</span><span class="plain-syntax">) </span><span class="identifier-syntax">addendum</span><span class="plain-syntax"> = </span><span class="string-syntax">"_corner_door"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">CROSSDOT_MAPBIT</span><span class="plain-syntax">) </span><span class="identifier-syntax">addendum</span><span class="plain-syntax"> = </span><span class="string-syntax">"_dot"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">addendum</span><span class="plain-syntax">[0] == </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">FADING_MAPBIT</span><span class="plain-syntax">)) </span><span class="identifier-syntax">addendum</span><span class="plain-syntax"> = </span><span class="string-syntax">"_fading"</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">icon_name</span><span class="plain-syntax">, </span><span class="string-syntax">"%s_arrow%s"</span><span class="plain-syntax">, </span><span class="identifier-syntax">clue</span><span class="plain-syntax">, </span><span class="identifier-syntax">addendum</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP16_2">&#167;16.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP16_2_2" class="paragraph-anchor"></a><b>&#167;16.2.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Compose a tool tip for this exit icon</span><span class="named-paragraph-number">16.2.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I3</span><span class="plain-syntax"> = </span><a href="4-sm.html#SP21" class="function-link"><span class="function-syntax">SpatialMap::room_exit</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">room_grid</span><span class="plain-syntax">[</span><span class="identifier-syntax">ROOM_GRID_POS</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">)], </span><span class="identifier-syntax">exit</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">D</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">I3</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">D</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">tool_tip</span><span class="plain-syntax">, </span><span class="string-syntax">"title=\""</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">direction_name</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">door_name</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">destination_name</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOOP_OVER_FAUX_INSTANCES</span><span class="plain-syntax">(</span><span class="identifier-syntax">faux_set</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">I</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">direction_index</span><span class="plain-syntax"> == </span><span class="identifier-syntax">exit</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><a href="2-fi.html#SP13" class="function-link"><span class="function-syntax">FauxInstances::write_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">direction_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">D</span><span class="plain-syntax">) </span><a href="2-fi.html#SP13" class="function-link"><span class="function-syntax">FauxInstances::write_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">door_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">D</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">I3</span><span class="plain-syntax">) </span><a href="2-fi.html#SP13" class="function-link"><span class="function-syntax">FauxInstances::write_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">destination_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">I3</span><span class="plain-syntax">);</span>

<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">D</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">I3</span><span class="plain-syntax">) </span><span class="identifier-syntax">Localisation::write_ttt</span><span class="plain-syntax">(</span><span class="identifier-syntax">tool_tip</span><span class="plain-syntax">, </span><span class="identifier-syntax">LD</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Mp.ExitThroughTooltip"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">direction_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">door_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">destination_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">Localisation::roman_tt</span><span class="plain-syntax">(</span><span class="identifier-syntax">tool_tip</span><span class="plain-syntax">, </span><span class="identifier-syntax">LD</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Mp.ExitBlockedTooltip"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">direction_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">door_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">I3</span><span class="plain-syntax">) </span><span class="identifier-syntax">Localisation::roman_tt</span><span class="plain-syntax">(</span><span class="identifier-syntax">tool_tip</span><span class="plain-syntax">, </span><span class="identifier-syntax">LD</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Index.Elements.Mp.ExitTooltip"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">direction_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">destination_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">tool_tip</span><span class="plain-syntax">, </span><span class="string-syntax">"\""</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">direction_name</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">door_name</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">destination_name</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP16_2">&#167;16.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP17" class="paragraph-anchor"></a><b>&#167;17. Plotting the single central square.</b>The following routine renders the square icons for the rooms themselves,
which are bordered and coloured single-cell tables.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">ROOM_BORDER_SIZE</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">B_ROOM_BORDER_SIZE</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::index_room_square</span><button class="popup" onclick="togglePopup('usagePopup16')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup16">Usage of <span class="code-font"><span class="function-syntax">HTMLMap::index_room_square</span></span>:<br/><a href="4-rhm.html#SP14_2_2_1_1">&#167;14.2.2.1.1</a>, <a href="4-rhm.html#SP19_1">&#167;19.1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="reserved-syntax">index_session</span><span class="plain-syntax"> *</span><span class="identifier-syntax">session</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">I</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">b</span><span class="plain-syntax"> = </span><span class="constant-syntax">ROOM_BORDER_SIZE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">I</span><span class="plain-syntax"> == </span><a href="2-fi.html#SP11" class="function-link"><span class="function-syntax">FauxInstances::benchmark</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">session</span><span class="plain-syntax">)) &amp;&amp; (</span><span class="identifier-syntax">pass</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">)) </span><span class="identifier-syntax">b</span><span class="plain-syntax"> = </span><span class="constant-syntax">B_ROOM_BORDER_SIZE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML_OPEN_WITH</span><span class="plain-syntax">(</span><span class="string-syntax">"table"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"border=\"%d\" cellpadding=\"0\" cellspacing=\"0\" "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"class=\"indexmaproom\" width=\"%d\" height=\"%d\" title=\"%S\""</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">b</span><span class="plain-syntax">, </span><span class="constant-syntax">MAP_CELL_INNER_SIZE</span><span class="plain-syntax">, </span><span class="constant-syntax">MAP_CELL_INNER_SIZE</span><span class="plain-syntax">, </span><a href="2-fi.html#SP13" class="function-link"><span class="function-syntax">FauxInstances::get_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML_OPEN_WITH</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">, </span><span class="string-syntax">"valign=\"middle\" align=\"center\" bgcolor=\"#%S\""</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">I</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">fimd</span><span class="plain-syntax">.</span><span class="element-syntax">colour</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP17_2" class="named-paragraph-link"><span class="named-paragraph">Enter the text colour</span><span class="named-paragraph-number">17.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP17_1" class="named-paragraph-link"><span class="named-paragraph">Write the text of the abbreviated name of the room</span><span class="named-paragraph-number">17.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP17_3" class="named-paragraph-link"><span class="named-paragraph">Exit the text colour</span><span class="named-paragraph-number">17.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"table"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP17_1" class="paragraph-anchor"></a><b>&#167;17.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Write the text of the abbreviated name of the room</span><span class="named-paragraph-number">17.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pass</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML_OPEN_WITH</span><span class="plain-syntax">(</span><span class="string-syntax">"a"</span><span class="plain-syntax">, </span><span class="string-syntax">"href=#wo_%d style=\"text-decoration: none\""</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">I</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">allocation_id</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP17_2" class="named-paragraph-link"><span class="named-paragraph">Enter the text colour</span><span class="named-paragraph-number">17.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">pass</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">I</span><span class="plain-syntax"> == </span><a href="2-fi.html#SP11" class="function-link"><span class="function-syntax">FauxInstances::benchmark</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">session</span><span class="plain-syntax">))) </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"b"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">abbrev</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">abbrev</span><span class="plain-syntax">, </span><span class="string-syntax">"%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">abbrev</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="identifier-syntax">abbrev</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML::put</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">pass</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">I</span><span class="plain-syntax"> == </span><a href="2-fi.html#SP11" class="function-link"><span class="function-syntax">FauxInstances::benchmark</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">session</span><span class="plain-syntax">))) </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"b"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pass</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) { </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP17_3" class="named-paragraph-link"><span class="named-paragraph">Exit the text colour</span><span class="named-paragraph-number">17.3</span></a></span><span class="plain-syntax">; </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"a"</span><span class="plain-syntax">); }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">abbrev</span><span class="plain-syntax">)</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP17">&#167;17</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP17_2" class="paragraph-anchor"></a><b>&#167;17.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Enter the text colour</span><span class="named-paragraph-number">17.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">fimd</span><span class="plain-syntax">.</span><span class="element-syntax">text_colour</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML::begin_colour</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">fimd</span><span class="plain-syntax">.</span><span class="element-syntax">text_colour</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML::begin_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"indexblack"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP17">&#167;17</a> and <a href="4-rhm.html#SP17_1">&#167;17.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP17_3" class="paragraph-anchor"></a><b>&#167;17.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Exit the text colour</span><span class="named-paragraph-number">17.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">fimd</span><span class="plain-syntax">.</span><span class="element-syntax">text_colour</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML::end_colour</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">HTML::end_span</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP17">&#167;17</a> and <a href="4-rhm.html#SP17_1">&#167;17.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP18" class="paragraph-anchor"></a><b>&#167;18. The colour chip.</b>The first of two extras, which aren't strictly speaking part of the HTML map.
This is the chip shown on the "details" box for a room in the World Index.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::colour_chip</span><button class="popup" onclick="togglePopup('usagePopup17')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup17">Usage of <span class="code-font"><span class="function-syntax">HTMLMap::colour_chip</span></span>:<br/>Map Element - <a href="3-me.html#SP3">&#167;3</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">Reg</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">at</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN_WITH</span><span class="plain-syntax">(</span><span class="string-syntax">"table"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"border=\"%d\" cellpadding=\"0\" cellspacing=\"0\" "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"bordercolor=\"indexmaproom\" height=\"%d\""</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="constant-syntax">ROOM_BORDER_SIZE</span><span class="plain-syntax">, </span><span class="constant-syntax">MAP_CELL_INNER_SIZE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN_WITH</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">, </span><span class="string-syntax">"valign=\"middle\" align=\"center\" bgcolor=\"#%S\""</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Reg</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">fimd</span><span class="plain-syntax">.</span><span class="element-syntax">colour</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&amp;nbsp;"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-fi.html#SP13" class="function-link"><span class="function-syntax">FauxInstances::write_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">Reg</span><span class="plain-syntax">); </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" region"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">at</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><a href="2-iu.html#SP2" class="function-link"><span class="function-syntax">IndexUtilities::link</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">at</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&amp;nbsp;"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"table"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP19" class="paragraph-anchor"></a><b>&#167;19. The regions key.</b>The part of the World Index showing which rooms belong to which regions. Note
that nothing is shown if all of the rooms are outside of regions.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::add_region_key</span><button class="popup" onclick="togglePopup('usagePopup18')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup18">Usage of <span class="code-font"><span class="function-syntax">HTMLMap::add_region_key</span></span>:<br/>Map Element - <a href="3-me.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">index_session</span><span class="plain-syntax"> *</span><span class="identifier-syntax">session</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">faux_instance_set</span><span class="plain-syntax"> *</span><span class="identifier-syntax">faux_set</span><span class="plain-syntax"> = </span><a href="1-ia.html#SP12" class="function-link"><span class="function-syntax">Indexing::get_set_of_instances</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">reg</span><span class="plain-syntax">; </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">count</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_FAUX_REGIONS</span><span class="plain-syntax">(</span><span class="identifier-syntax">faux_set</span><span class="plain-syntax">, </span><span class="identifier-syntax">reg</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">count</span><span class="plain-syntax"> += </span><a href="4-rhm.html#SP19" class="function-link"><span class="function-syntax">HTMLMap::add_key_for</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">reg</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">count</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">count</span><span class="plain-syntax"> += </span><a href="4-rhm.html#SP19" class="function-link"><span class="function-syntax">HTMLMap::add_key_for</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">count</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">HTML_TAG</span><span class="plain-syntax">(</span><span class="string-syntax">"hr"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">HTMLMap::add_key_for</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">reg</span><span class="plain-syntax">, </span><span class="reserved-syntax">index_session</span><span class="plain-syntax"> *</span><span class="identifier-syntax">session</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">faux_instance_set</span><span class="plain-syntax"> *</span><span class="identifier-syntax">faux_set</span><span class="plain-syntax"> = </span><a href="1-ia.html#SP12" class="function-link"><span class="function-syntax">Indexing::get_set_of_instances</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">count</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">faux_instance</span><span class="plain-syntax"> *</span><span class="identifier-syntax">R</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_FAUX_ROOMS</span><span class="plain-syntax">(</span><span class="identifier-syntax">faux_set</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-fi.html#SP13" class="function-link"><span class="function-syntax">FauxInstances::region_of</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">) == </span><span class="identifier-syntax">reg</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">count</span><span class="plain-syntax">++ == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP19_1" class="named-paragraph-link"><span class="named-paragraph">Start the region key table for this region</span><span class="named-paragraph-number">19.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">", "</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%S"</span><span class="plain-syntax">, </span><a href="2-fi.html#SP13" class="function-link"><span class="function-syntax">FauxInstances::get_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">R</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">count</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="4-rhm.html#SP19_2" class="named-paragraph-link"><span class="named-paragraph">End the region key table for this region</span><span class="named-paragraph-number">19.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">count</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP19_1" class="paragraph-anchor"></a><b>&#167;19.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Start the region key table for this region</span><span class="named-paragraph-number">19.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"p"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::begin_plain_html_table</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN</span><span class="plain-syntax">(</span><span class="string-syntax">"tr"</span><span class="plain-syntax">); </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN_WITH</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">, </span><span class="string-syntax">"width=\"40\" valign=\"middle\" align=\"left\""</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-rhm.html#SP17" class="function-link"><span class="function-syntax">HTMLMap::index_room_square</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">, </span><span class="identifier-syntax">session</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">); </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_OPEN_WITH</span><span class="plain-syntax">(</span><span class="string-syntax">"td"</span><span class="plain-syntax">, </span><span class="string-syntax">"valign=\"middle\" align=\"left\""</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;b&gt;"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">reg</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%S"</span><span class="plain-syntax">, </span><a href="2-fi.html#SP13" class="function-link"><span class="function-syntax">FauxInstances::get_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">reg</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;i&gt;Not in any region&lt;/i&gt;"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;/b&gt;: "</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP19">&#167;19</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP19_2" class="paragraph-anchor"></a><b>&#167;19.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">End the region key table for this region</span><span class="named-paragraph-number">19.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::end_html_row</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML::end_html_table</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">HTML_CLOSE</span><span class="plain-syntax">(</span><span class="string-syntax">"p"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-rhm.html#SP19">&#167;19</a>.</li></ul>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="4-sm.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-im.html">1</a></li><li class="progresschapter"><a href="2-il.html">2</a></li><li class="progresschapter"><a href="3-tpt.html">3</a></li><li class="progresscurrentchapter">4</li><li class="progresssection"><a href="4-mc.html">mc</a></li><li class="progresssection"><a href="4-sg.html">sg</a></li><li class="progresssection"><a href="4-sm.html">sm</a></li><li class="progresscurrent">rhm</li><li class="progresssection"><a href="4-rem.html">rem</a></li><li class="progressnext"><a href="4-rem.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

